<script>
$(document).ready(function(){
    $("#sTable").tablesorter();
    $("#sTable tbody tr").click(function(){

    	var sn = $(this).attr('id');
		$.getJSON('<?php echo $this->route("get-transfer-data-byid")?>',{sn:sn},function(data){
			$.each(data,function(i,v){
				if ($("#move_in-"+i+"-"+v).attr('type')=='radio'){
                    $("#move_in-"+i+"-"+v).attr('checked','checked');
                }else {
                    $("#move_in-"+i).val(v);
                }
			});

		$("#class_id").val($.sprintf('%d%02d', data.grade,data.class_sn));
    	$("#selForm").attr('action','<?php echo $this->route("movein-edit")?>');
    	$("#move_in-student_id").attr('disabled','disabled');
    	$("#move_in-number").attr('disabled','disabled');
    	$("#move_in-name").attr('disabled','disabled');
    	$("#move_in-sex-M").attr('disabled','disabled');
    	$("#move_in-sex-F").attr('disabled','disabled');
    	$("#class_id").attr('disabled','disabled');
    	$("#saveBtn").attr('disabled','');
		});
    });

    $('#sTable tbody tr').closeDOMWindow({eventType:'click'});

    $("#sTable tbody tr").mouseover(function() {
		$(this).addClass("trover");}).mouseout(function() {
			$(this).removeClass("trover");});

});
</script>
<table id="sTable" class="tablesorter">
<thead><tr>
	<th>#</th>
	<th><?php echo $this->translate('date')?></th>
	<th><?php echo $this->translate('causation_kind')?></th>
	<th><?php echo $this->translate('student_id')?></th>
	<th><?php echo $this->translate('name')?></th>
	<th><?php echo $this->translate('class_sn')?></th>
	<th><?php echo $this->translate('number')?></th>
	<th><?php echo $this->translate('sex')?></th>
	<th><?php echo $this->translate('identification_number')?></th>
	<th><?php echo $this->translate('county')?></th>
	<th><?php echo $this->translate('school_name')?></th>
	<th><?php echo $this->translate('school_id')?></th>
	<th><?php echo $this->translate('approve_organ')?></th>
	<th><?php echo $this->translate('causation')?></th>
	<th><?php echo $this->translate('approve_date')?></td>
    <th><?php echo $this->translate('approve_word')?></td>
	<th><?php echo $this->translate('approve_number')?></td>
</tr></thead>
<tbody>
<?php $i=0;?>
<?php foreach($this->data as $val):?>
<tr id="<?php echo $val['sn']?>">
	<td><?php echo ++$i?></td>
	<td><?php echo $val['date']?></td>
	<td><?php echo $this->transfer_kind_arr[$val['causation_kind']]?></td>
	<td><?php echo $val['student_id']?></td>
	<td><?php echo $val['name']?></td>
	<td><?php echo sprintf("%d%02d",$val['grade'] ,$val['class_sn'])?></td>
	<td><?php echo $val['number']?></td>
	<td><?php echo $val['sex']?></td>
	<td><?php echo $val['identification_number']?></td>
	<td><?php echo $val['county']?></td>
	<td><?php echo $val['school_name']?></td>
	<td><?php echo $val['school_id']?></td>
	<td><?php echo $val['approve_organ']?></td>
	<td><?php echo $val['causation']?></td>
	<td><?php echo $val['approve_date']?></td>
    <td><?php echo $val['approve_word']?></td>
	<td><?php echo $val['approve_number']?></td>
</tr>
<?php endforeach?>
</tbody>
</table>